package com.yanqu.road.logic.redis;

import com.alibaba.fastjson.JSONObject;

public class RedisKeyDefineHelper {

    /**
     * 获取区服在线数量
     *
     * @param serverId
     * @return
     */
    public static String getServerOnlineCountKey(long serverId) {
        return RedisKeyDefine.SERVER_ONLINE_COUNT + "_" + serverId;
    }

    /**
     * 玩家注册过的区服数据
     * @param openId
     * @return
     */
    public static String getPlayerRegisterServerListKey(String openId) {
        return RedisKeyDefine.PLAYER_REGISTER_SERVER_LIST + "_" + openId;
    }

    /**
     * 第三方敏感词库
     * @param appId
     * @return
     */
    public static String getForbiddenWordsListKey(String appId, String channelID) {
        return RedisKeyDefine.FORBIDDEN_WORDS + "_" + appId + "_" + channelID;
    }

    /**
     * 服务器注册玩家数
     *
     * @return
     */
    public static String getServerRegisterNumKey() {
        return RedisKeyDefine.SERVER_REGISTER_PLAYER_NUM;
    }

    public static String getChannelSystemConfigKey(int channelId) {
        return RedisKeyDefine.CHANNEL_SYSTEM_CONFIG + "_" + channelId;
    }

    public static String getChannelSystemConfigPublishMsg(int channelId) {
        JSONObject msg = new JSONObject();
        msg.put("channelId", channelId);
        msg.put("type", RedisKeyDefine.CHANNEL_SYSTEM_CONFIG_PUBLISH);
        return msg.toJSONString();
    }

    public static String getChannelSystemLoopKey(int channelId) {
        return RedisKeyDefine.CHANNEL_SYSTEM_LOOP + "_" + channelId;
    }

    public static String getChannelLoopPublishMsg(int channelId) {
        JSONObject msg = new JSONObject();
        msg.put("channelId", channelId);
        msg.put("type", RedisKeyDefine.CHANNEL_SYSTEM_LOOP_PUBLISH);
        return msg.toJSONString();
    }

    public static String getServerRoleCreateCountKey(){
        return RedisKeyDefine.SERVER_ROLE_CREATE_COUNT;
    }

    public static String getServerRoleCreateCount2Key(){
        return RedisKeyDefine.SERVER_ROLE_CREATE_COUNT_2;
    }

    public static String getForbiddenWordPublishMsg() {
        JSONObject msg = new JSONObject();
        msg.put("type", RedisKeyDefine.FORBIDDEN_WORD_PUBLISH);
        return msg.toJSONString();
    }
}
